//
//  ShareView.m
//  ZiJinLian
//
//  Created by 🐛 on 2017/6/19.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "ShareView.h"

@implementation ShareView

-(id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor=[UIColor clearColor];
        //self.alpha=0.5;
        self.alphaView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, MainW, MainH-250)];
        self.alphaView.backgroundColor=[UIColor clearColor];
        [self addSubview:_alphaView];
        self.mainView=[[UIView alloc]initWithFrame:CGRectMake(0, MainH-250, MainW, 250)];
        self.mainView.backgroundColor=[UIColor whiteColor];
        [self addSubview:self.mainView];
        MYLabel *label=[[MYLabel alloc]initWithFrame:CGRectMake(0, 30, MainW, 20)];
        label.text=@"分享到";
        label.textAlignment=1;
        label.textColor=TextColor3;
        [self.mainView addSubview:label];
        CGFloat W=(MainW-220)/3;
        NSArray*name=@[@"微信",@"朋友圈",@"QQ好友",@"QQ空间"];
    NSArray*img=@[@"icon_wechat",@"icon_wechat_friends",@"icon_qq",@"icon_qq_space"];
        for (int i=0; i<4; i++) {
            FL_Button *Abtn=[[FL_Button alloc]initWithAlignmentStatus:FLAlignmentStatusTop];
            Abtn.frame=CGRectMake(30+(W+40)*i, label.bsg_bottom+30, 40, 40);
            Abtn.tag=100+i;
            [Abtn addTarget:self action:@selector(addNewAccoutClick:) forControlEvents:UIControlEventTouchUpInside];
            [Abtn setTitle:name[i] forState:UIControlStateNormal];
            [Abtn setTitleColor:TextColor6 forState:UIControlStateNormal];
            //Wbtn.backgroundColor=[UIColor redColor];
            Abtn.titleLabel.font=FontAndStyle12;
            [Abtn setBackgroundImage:[UIImage imageNamed:img[i]] forState:UIControlStateNormal];
            [self.mainView addSubview:Abtn];
        }
        UIButton *cancle=[[UIButton alloc]initWithFrame:CGRectMake(0, 200, MainW, 50)];
        cancle.backgroundColor=[UIColor colorWithHexString:@"#f6f6f6"];
        [cancle setTitle:@"取消" forState:0];
        [cancle setTitleColor:TextColor3 forState:0];
        cancle.titleLabel.font=[UIFont systemFontOfSize:15];
        [cancle addTarget:self action:@selector(cancleShareClick) forControlEvents:UIControlEventTouchUpInside];
        [self.mainView addSubview:cancle];
    }
    return self;
}
-(void)cancleShareClick{
    [_delegate cancleShareClick];
}
-(void)addNewAccoutClick:(FL_Button *)sender{
    [_delegate chooseShareToWhich:sender];
}
@end
